{% if user_session.logined %}
<div id="submit-page-loading" align="center"><img src="/static/images/loader.gif"></div>
<div id="submit-page" style="display: none;">
    <form id="code-submit-form" action="{% if asgn != None %}{% url 'asgn_save_submission' asgn.id problem.id %}{% elif contest != None %}{% url 'contest_submit_code' contest.id problem.id %}{% else %}{% url 'problem_submit' problem.id %}{% endif %}" method="post" enctype="multipart/form-data">
        <div class="my-tab-container"  style="padding: 0;">
            <textarea id="code-editor" name="content"></textarea>
        </div>
        <br />
        <div class="btn-group">
            <button class="btn btn-danger" id="format_code" type="button">格式化代码</button>
            {% if 'gcc' in language_provider %}
            <button class="btn btn-default slc-lang btn-primary lang-gcc" type="button" value="gcc">C语言</button>
            {% endif %}
            {% if 'gcc-cpp' in language_provider %}
            <button class="btn btn-default slc-lang lang-gcc-cpp" type="button" value="gcc-cpp">C++</button>
            {% endif %}
            {% if 'java' in language_provider %}
            <button class="btn btn-default slc-lang lang-java" type="button" value="java">Java</button>
            {% endif %}
            <button class="btn btn-success" type="submit" id="btn_submit">提交代码</button>
        </div>
        <input type="hidden" name="lang" value="gcc" id="code_lang" />
    </form>
</div>
<div id="waiting_box" style="min-height: 300px; padding: 20px; display: none;" >
    <div id="judge_message" align="center" style="display: none;">
        <div align="center"><img src="/static/images/loader.gif"></div>
        <h4 id="judge_message_distance">正在等待评测结果...</h4>
        <br />
        <span style="color: #666;">
            如果长时间没有结果，
            <a href="javascript:void(0)" onclick="$('#submit-page').show();$('#waiting_box').hide();clearTimeout(get_status_timer);">点此返回编辑器</a>
            或者
            <a href="{% url 'problem_judge_status' %}" target="_blank">点此查看全局评测队列</a> 。
        </span>
        <br /><br />
        <span style="color: #999;">
            <span class="glyphicon glyphicon-info-sign"></span>&nbsp;
            偶然的情况下可能因网络问题或者评测系统的问题导致评测结果不能及时呈现，请见谅，并且不要重复提交代码，可以向管理员或老师反馈情况。
        </span>
    </div>
    <div id="judge_result" align="center" style="display: none;">
        <h1><span class="glyphicon glyphicon-ok" id="judge_result_icon"></span>&nbsp;<span id="judge_result_title">评测通过</span></h1>
        <h5 id="judge_result_content">恭喜，您的代码顺利通过评测</h5><br />
        <div class="btn-group">
            <a href="javascript:void(0)" onclick="$('#submit-page').show();$('#waiting_box').hide();clearTimeout(get_status_timer);" class="btn btn-primary">返回编辑器</a>
            <a href="{% if asgn != None %}{% url 'asgn_status_list' asgn.id %}{% elif contest != None %}{% url 'contest_status' contest.id %}{% else %}{% url 'problem_judge_status' %}{% endif %}" target="_blank" class="btn btn-default">全局评测队列</a>
            <a id="judge_status_report" href="" target="_blank" class="btn btn-success">评测机报告</a>
        </div>
    </div>
    <div class="judge_result_detail" style="margin-top: 40px;">
        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>消息</th>
                    <th>测试数据</th>
                    <th>时间使用</th>
                    <th>内存使用</th>
                    <th>评测情况</th>
                </tr>
            </thead>
            <tbody id="judge_result_detail_body">

            </tbody>
        </table>
    </div>
</div>
{% else %}
    <div class="my-tab-container">
        <div class="alert alert-danger">请先登录</div>
    </div>
{% endif %}